package com.zzh.welcome;

import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;

import com.zzh.base.component.BaseActivity;
import com.zzh.login.LoginActivity;
import com.zzh.login.R;
import com.zzh.other.IntentJump;
import com.zzh.tools.IntentUtil;

public class WelcomeActivity extends BaseActivity {

    @Override
    public View getRootView() {
        return LayoutInflater.from(this).inflate(R.layout.activity_welcome, null);
    }

    @Override
    public void findView() {
        mHandler.sendEmptyMessage(3000);
    }

    @Override
    public void superAfter() {
        super.superAfter();
        hiddenTitle();
    }

    @Override
    public void setClickLinsener() {

    }

    private Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            String isUseLogin = WelcomeActivity.this.getResources().getString(R.string.is_use_login);
            if (isUseLogin.equals("true")) {
                IntentUtil.get().goActivity(WelcomeActivity.this, LoginActivity.class);
                finish();
            } else {
                boolean skipStatus = IntentJump.skip(WelcomeActivity.this);
                if (skipStatus) {
                    finish();
                }
            }
        }
    };

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mHandler != null) {
            mHandler.removeCallbacksAndMessages(null);
        }
    }
}
